/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.mala.generic;

import java.util.List;
import java.util.Map;

/**
 *
 * @author joao
 * @param <T>
 */
public interface DAOGeneric<T> {
 
    T login(String username, String password);
    
    void create(T entidade);

    void edit(T entidade);

    void destroy(T entidade);

    void executeUpdate(String oql);
    
    @SuppressWarnings("unchecked")
    T getPorId(Object id);

    // Consultada manuais dinamicas
    @SuppressWarnings(value = "unchecked")
    List<T> get(String oql);

    @SuppressWarnings(value = "unchecked")
    List<T> get(String oql, List<String> campos);

    @SuppressWarnings(value = "unchecked")
    List<T> get(String oql, Object... campos);

    // Consultada com query estatucas
    @SuppressWarnings(value = "unchecked")
    List<T> getPorQuery(String query);

    @SuppressWarnings(value = "unchecked")
    List<T> getPorQuery(String query, Object... campos);

    @SuppressWarnings(value = "unchecked")
    int getCount(String entidade);

    @SuppressWarnings(value = "unchecked")
    int getCount(String entidade, String where);

    @SuppressWarnings(value = "unchecked")
    int getCountQuery(String oql);

    @SuppressWarnings(value = "unchecked")
    List<T> getNative(String cTabela, int first, int pageSize, String sortField, boolean sortOrder, Map<String, String> filters, String cParametroSQL);

    @SuppressWarnings(value = "unchecked")
    List<T> getNative(String cTabela, int first, int pageSize, String sortField, boolean sortOrder, Map<String, String> filters, String cParametroSQL, String cFiltro);

    @SuppressWarnings(value = "unchecked")
    List<T> getNativeFiltroList(String cSql);
    
    @SuppressWarnings(value = "unchecked")
    T getNativeFiltro(String cSql);
    
    T getEntidade(String oql, List<String> campos);
    
    @SuppressWarnings("unchecked")
    List<T> loadAll();
}
